package com.doumuxie.frame;

import com.doumuxie.linstener.ProductConsumeListener;

import javax.swing.*;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

/**
 * @author doumuxie https://gitee.com/doumuxie/
 * @version 1.0
 * @date 2020/10/17 11:55
 * @description 生产者消费者页面
 **/
public class ProductConsumeFrame extends JFrame {

    private JButton createBtn;

    private ProductConsumePanel productConsumePanel;

    public ProductConsumePanel getProductConsumePanel() {
        return productConsumePanel;
    }

    public ProductConsumeFrame() {
        super("生产者-消费者");
        this.setSize(800, 500);
        createBtn = new JButton("开始运行 生产者*7， 消费者*4， 库存MAX=5");
        createBtn.setBounds(10, 10, 200, 30);
        createBtn.addActionListener(new ProductConsumeListener(this));
        productConsumePanel = new ProductConsumePanel();
        this.add(productConsumePanel, BorderLayout.CENTER);
        this.add(createBtn, BorderLayout.NORTH);

    }

    public JButton getCreateBtn() {
        return createBtn;
    }
}
